package com.ctgu.expresshelper.dao;

import com.ctgu.expresshelper.entity.Express;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Mapper
@Component
public interface ExpressDao {

    @Select("select * from express where expressNum=#{expressNum} and userid=#{userid}")
    Express selectExpressByNum(String expressNum,String userid);

    @Insert("insert into express(expressNum,name,status,updatetime,userid,code) values(#{expressNum},#{name},#{status},#{updatetime},#{userid},#{code})")
    void addExpress(Express express);

    @Delete("delete from express where expressNum=#{expressNum} and userid=#{userid}")
    void deleteExpress(String expressNum,int userid);

    @Select("select * from express where userid=#{userid}")
    List<Express> selectAllExpressByUserid(int userid);

    @Select("select * from express where userid=#{userid} and status=#{status}")
    List<Express> selectExpressByUseridAndStatus(int userid,int status);


}
